import 'dart:math';

import 'package:word_game/engine/core.dart';
import 'package:word_game/battle/battle.dart';

class YJMSkill extends Skill {
  YJMSkill() : super('一剪梅') {
    Debuff hungry = Debuff();
    hungry.name = '流血';
    hungry.lastRound = 3;
    hungry.noAttack = false;
    AttackAction action = AttackAction();
    action.attackType = DamageType.physical;
    action.attackNumber = 20;
    hungry.action = action;
    debuffs = [hungry];
    Buff weakness = Buff();
    weakness.name = '弱点攻击';
    weakness.lastRound = 10;
    weakness.critRateIncrement = 50;
    buffs.add(weakness);
  }

  @override
  List<Monster> determineTargets(List<Monster> alternatives) {
    if (alternatives == null || alternatives.length == 0) {
      return null;
    }
    int index = Random.secure().nextInt(alternatives.length);
    return [alternatives[index]];
  }

  @override
  AttackAction determineAction(Hero hero) {
    AttackAction action = AttackAction();
    action.attackType = DamageType.physical;
    action.attackNumber = hero.attackPower * 3;
    return action;
  }
  
}